
package fileby.ctrl.actions.impl;

import fileby.model.IModel;
import java.awt.event.ActionEvent;
import java.awt.event.InputEvent;
import java.awt.event.KeyEvent;
import javax.swing.AbstractAction;
import javax.swing.KeyStroke;

/**
 *
 * @author Ludwig Kjellstrom
 */
class QuitAction extends AbstractAction{

    private IModel model;

    public QuitAction(IModel model) {
        super("Exit", null);
        this.model = model;
        putValue(SHORT_DESCRIPTION, "Exits the application.");
        putValue(MNEMONIC_KEY, KeyEvent.VK_X);
        putValue(ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_F4, InputEvent.ALT_DOWN_MASK));
    }

    public void actionPerformed(ActionEvent e) {
        model.quit();
    }
}
